<?php    session_start();?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Triumph - Add New Employee</title>
        <link href="maintenancePagesCSS.css" REL="StyleSheet" TYPE="text/css" >
    </head>
    <body>
    <center>
        <table width="1000" height="632" border="0" background="images/background.jpg">
          <tr>
            <th height="488" scope="col"><p>
              <span style="font-family: Arial"><img src="images/TitleAddEmployee.gif" alt="Add Employee" width="514" height="67"></span></p>
              <p>
                <?php
            include "EmployeeDao.php";
            include "Datasource.php";
            $objEmployeeDAO = new EmployeeDao();
            $objDatasource = new Datasource("localhost", "theanykey", "root", "");

            include "Employee.php";
            $objEmployee = new Employee();
            $objEmployee->setFirstName($_POST['txtEmployeeFirstName']);
            $objEmployee->setLastName($_POST['txtEmployeeLastName']);
            $objEmployee->setLoginID($_POST['txtLoginID']);
            
            $objEmployee->setPassword($_POST['txtEmployeePwd']);
            $objEmployee->setRole($_POST['selRole']);
            $objEmployee->setEmpID(null);
            $objEmployee->setIsDeleted('N');

            $txtEmployeeLastName = $_POST['txtEmployeeLastName'];

            if($objEmployeeDAO->create($objDatasource, $objEmployee))
            {
                print("<div class='SelectTable'><font style='color: WHITE;'><B>RECORD FOR:</B><br/><table>");
                $lastName = $objEmployee->getLastName();
                $firstName = $objEmployee->getFirstName();
                $loginID = $objEmployee->getLoginID();
                $pw = $objEmployee->getPassword();
                $role = $objEmployee->getRole();
                print("<tr><td align='right'>Last Name:&nbsp;</td><td> $lastName </td></tr>");
                print("<tr><td align='right'>First Name:&nbsp;</td><td> $firstName</td></tr>");
                print("<tr><td align='right'>Logid ID:&nbsp;</td><td> $loginID</td></tr>");
                print("<tr><td align='right'>PW:&nbsp;</td><td>");
                for($i = 0; $i < strlen($pw); $i++)
                {
                    print("*");
                }
                print("</td></tr>");
                print("<tr><td align='right'>Role: &nbsp;</td><td>$role </td></tr></table>");
                print("<U>Employee successfully added to the database.</U></font>");
            }
            else
            {
                print("<font style='color: Red'>");
                print("There was an error adding the Employee Record.<br/>Please Try Again<br/>");
                print("</font>");

            }
            print " </div>";
        ?>
              </p>
              <br/>
              <br/>
              <center>
			  <script src="links.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript">
            writeEmployeeLinks("", "");
</script>
            </center>            </th>
          </tr>
          <tr>
            <th height="138" scope="col">&nbsp;</th>
          </tr>
    </table>
        <center>
        </center>
    </body>
</html>
